<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<h1>哈哈，Hello, World!</h1>
<p>Here is some content on my page.</p>
<div id="app" style="width: 500px;height: 300px;background-color: gainsboro">

</div>

<!--<script src="https://unpkg.com/axios/dist/axios.min.js"></script>-->
<!--<script src="https://cdn.jsdelivr.net/npm/axios/dist/axios.min.js"></script>-->
<script>

    // const http = axios.create({
    //     baseURL: `http://${window.location.hostname}:${window.location.port}/`,
    //     timeout: 10000000,
    //     responseType: 'stream',
    //     onDownloadProgress: function (progressEvent) {
    //         // 处理原生进度事件
    //         // console.log("progressEvent->",progressEvent.event.currentTarget.responseText);
    //         document.getElementById("app").innerHTML =
    //             progressEvent.event.currentTarget.responseText
    //         // responseText 就是sse的完整数据
    //     },
    // });

    fetch('/sse')
        .then(function (response) {
            // 处理成功情况
            console.log(response);
        })
        .catch(function (error) {
            // 处理错误情况
            console.log(error);
        })
        .finally(function () {
            // 总是会执行
        });
</script>

</body>
</html>